package com.cgx.tablet.beeper.presenter;

import com.cgx.tablet.beeper.api.ApiCallback;
import com.cgx.tablet.beeper.api.ApiUtil;
import com.cgx.tablet.beeper.base.BasePresenter;
import com.cgx.tablet.beeper.bean.WinTransBean;
import com.cgx.tablet.beeper.bean.response.ListResponse;
import com.cgx.tablet.beeper.bean.response.MsgResponse;
import com.cgx.tablet.beeper.view.IWinTransView;

/**
 * Created by Administrator on 2018/9/14 0014.
 */

public class WinTransPresenter extends BasePresenter{

    private IWinTransView view;
    public WinTransPresenter(IWinTransView view) {
        super(view);
        this.view = view;
    }

    public void getWins(String bizid) {
        callApi(ApiUtil.apiService.getWins(bizid), new ApiCallback<ListResponse<WinTransBean>>() {
            @Override
            public void onSuccess(final ListResponse<WinTransBean> response) {
                view.getWinsSuccess(response.getData());
            }

            @Override
            public void onFail(String code, String msg) {
                view.getWinsFail(code, msg);
            }
        }, false);
    }

    public void winTrans(String tid, String winId, boolean priority) {
        callApi(ApiUtil.apiService.winTrans(tid, winId, priority), new ApiCallback<MsgResponse>() {
            @Override
            public void onSuccess(final MsgResponse response) {
                view.winTransSuccess();
            }

            @Override
            public void onFail(String code, String msg) {
                view.winTransFail(code, msg);
            }
        });
    }
}
